package com.selfmade.transferutil.model;

/**
 * Created by Selfmade on 2017/7/23/0023.
 */

public class Data implements Comparable<Data>{

    private String transfer;
    private String receiver;
    private int money;
    private String time;

    public Data(String transfer, String receiver, int money, String time) {
        this.transfer = transfer;
        this.receiver = receiver;
        this.money = money;
        this.time = time;
    }

    public String getTransfer() {
        return transfer;
    }

    public void setTransfer(String transfer) {
        this.transfer = transfer;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }
    /**
     * 按时间从近到远排序
     */
    @Override
    public int compareTo(Data o) {
        return -(int) (Long.parseLong(this.time) - Long.parseLong(o.getTime()));
    }
    @Override
    public String toString() {
        return "Data{" +
                "transfer='" + transfer + '\'' +
                ", receiver='" + receiver + '\'' +
                ", money=" + money +
                ", time='" + time + '\'' +
                '}';
    }
}
